home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15804 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  2.3 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 6d 61 | 67 72 69 74 74 65 2e 69 |Path: ma|gritte.i|
|00000010| 74 73 2e 72 70 69 2e 65 | 64 75 21 68 61 73 68 69 |ts.rpi.e|du!hashi|
|00000020| 6b 0a 46 72 6f 6d 3a 20 | 4b 65 6e 67 6f 20 48 61 |k.From: |Kengo Ha|
|00000030| 73 68 69 6d 6f 74 6f 20 | 3c 68 61 73 68 69 6b 40 |shimoto |<hashik@|
|00000040| 72 70 69 2e 65 64 75 3e | 0a 4e 65 77 73 67 72 6f |rpi.edu>|.Newsgro|
|00000050| 75 70 73 3a 20 63 6f 6d | 70 2e 6c 61 6e 67 2e 63 |ups: com|p.lang.c|
|00000060| 2c 63 6f 6d 70 2e 6c 61 | 6e 67 2e 63 2b 2b 0a 53 |,comp.la|ng.c++.S|
|00000070| 75 62 6a 65 63 74 3a 20 | 52 65 3a 20 72 65 74 75 |ubject: |Re: retu|
|00000080| 72 6e 69 6e 67 20 61 6e | 20 61 72 72 61 79 20 66 |rning an| array f|
|00000090| 72 6f 6d 20 66 75 6e 63 | 74 69 6f 6e 0a 44 61 74 |rom func|tion.Dat|
|000000a0| 65 3a 20 53 75 6e 2c 20 | 37 20 41 70 72 20 31 39 |e: Sun, |7 Apr 19|
|000000b0| 39 36 20 30 33 3a 35 36 | 3a 32 37 20 2d 30 34 30 |96 03:56|:27 -040|
|000000c0| 30 0a 4f 72 67 61 6e 69 | 7a 61 74 69 6f 6e 3a 20 |0.Organi|zation: |
|000000d0| 52 65 6e 73 73 65 6c 61 | 65 72 20 50 6f 6c 79 74 |Renssela|er Polyt|
|000000e0| 65 63 68 6e 69 63 20 49 | 6e 73 74 69 74 75 74 65 |echnic I|nstitute|
|000000f0| 2c 20 54 72 6f 79 20 4e | 59 2c 20 55 53 41 0a 4d |, Troy N|Y, USA.M|
|00000100| 65 73 73 61 67 65 2d 49 | 44 3a 20 3c 50 69 6e 65 |essage-I|D: <Pine|
|00000110| 2e 41 33 32 2e 33 2e 39 | 31 2e 39 36 30 34 30 37 |.A32.3.9|1.960407|
|00000120| 30 33 35 33 31 33 2e 31 | 31 35 39 38 32 45 2d 31 |035313.1|15982E-1|
|00000130| 30 30 30 30 30 40 6d 61 | 67 72 69 74 74 65 2e 69 |00000@ma|gritte.i|
|00000140| 74 73 2e 72 70 69 2e 65 | 64 75 3e 0a 52 65 66 65 |ts.rpi.e|du>.Refe|
|00000150| 72 65 6e 63 65 73 3a 20 | 3c 34 6a 73 74 64 38 24 |rences: |<4jstd8$|
|00000160| 6b 68 30 40 6e 65 77 73 | 31 2e 73 75 6e 62 65 6c |kh0@news|1.sunbel|
|00000170| 74 2e 6e 65 74 3e 0a 4e | 4e 54 50 2d 50 6f 73 74 |t.net>.N|NTP-Post|
|00000180| 69 6e 67 2d 48 6f 73 74 | 3a 20 6d 61 67 72 69 74 |ing-Host|: magrit|
|00000190| 74 65 2e 69 74 73 2e 72 | 70 69 2e 65 64 75 0a 4d |te.its.r|pi.edu.M|
|000001a0| 69 6d 65 2d 56 65 72 73 | 69 6f 6e 3a 20 31 2e 30 |ime-Vers|ion: 1.0|
|000001b0| 0a 43 6f 6e 74 65 6e 74 | 2d 54 79 70 65 3a 20 54 |.Content|-Type: T|
|000001c0| 45 58 54 2f 50 4c 41 49 | 4e 3b 20 63 68 61 72 73 |EXT/PLAI|N; chars|
|000001d0| 65 74 3d 55 53 2d 41 53 | 43 49 49 0a 58 2d 53 65 |et=US-AS|CII.X-Se|
|000001e0| 6e 64 65 72 3a 20 68 61 | 73 68 69 6b 40 6d 61 67 |nder: ha|shik@mag|
|000001f0| 72 69 74 74 65 2e 69 74 | 73 2e 72 70 69 2e 65 64 |ritte.it|s.rpi.ed|
|00000200| 75 0a 49 6e 2d 52 65 70 | 6c 79 2d 54 6f 3a 20 3c |u.In-Rep|ly-To: <|
|00000210| 34 6a 73 74 64 38 24 6b | 68 30 40 6e 65 77 73 31 |4jstd8$k|h0@news1|
|00000220| 2e 73 75 6e 62 65 6c 74 | 2e 6e 65 74 3e 20 0a 0a |.sunbelt|.net> ..|
|00000230| 4a 75 73 74 20 64 6f 20 | 61 20 63 61 6c 6c 2d 62 |Just do |a call-b|
|00000240| 79 2d 72 65 66 65 72 65 | 6e 63 65 20 74 6f 20 74 |y-refere|nce to t|
|00000250| 68 65 20 61 72 72 61 79 | 2c 20 6f 72 20 72 65 74 |he array|, or ret|
|00000260| 75 72 6e 20 61 20 70 6f | 69 6e 74 65 72 20 74 6f |urn a po|inter to|
|00000270| 20 74 68 65 20 0a 66 69 | 72 73 74 20 6d 65 6d 62 | the .fi|rst memb|
|00000280| 65 72 20 6f 66 20 74 68 | 65 20 61 72 72 61 79 2e |er of th|e array.|
|00000290| 20 48 65 72 65 20 61 72 | 65 20 65 78 61 6d 70 6c | Here ar|e exampl|
|000002a0| 65 73 3a 0a 0a 63 61 6c | 6c 2d 62 79 2d 72 65 66 |es:..cal|l-by-ref|
|000002b0| 65 72 65 6e 63 65 3a 0a | 0a 76 6f 69 64 20 66 6f |erence:.|.void fo|
|000002c0| 6f 28 69 6e 74 20 26 5b | 5d 29 3b 20 20 20 20 2f |o(int &[|]); /|
|000002d0| 2f 20 6a 75 73 74 20 70 | 61 73 73 20 74 68 65 20 |/ just p|ass the |
|000002e0| 61 72 72 61 79 20 69 6e | 20 74 68 65 72 65 2c 20 |array in| there, |
|000002f0| 6d 61 6e 69 70 75 6c 61 | 74 65 20 69 74 20 0a 20 |manipula|te it . |
|00000300| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000310| 20 20 20 20 20 2f 2f 20 | 77 69 74 68 69 6e 20 66 | // |within f|
|00000320| 6f 6f 28 29 2c 20 61 6e | 64 20 74 68 65 20 6f 72 |oo(), an|d the or|
|00000330| 69 67 69 6e 61 6c 20 63 | 6f 70 79 20 77 6f 75 6c |iginal c|opy woul|
|00000340| 64 20 62 65 20 0a 20 20 | 20 20 20 20 20 20 20 20 |d be . | |
|00000350| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2f 20 6d | | // m|
|00000360| 6f 64 69 66 69 65 64 20 | 61 73 20 77 65 6c 6c 2e |odified |as well.|
|00000370| 0a 0a 72 65 74 75 72 6e | 69 6e 67 20 61 20 70 6f |..return|ing a po|
|00000380| 69 6e 74 65 72 3a 0a 69 | 6e 74 20 2a 66 6f 6f 28 |inter:.i|nt *foo(|
|00000390| 29 3b 0a 0a 69 6e 74 20 | 62 61 72 5b 61 72 72 61 |);..int |bar[arra|
|000003a0| 79 73 69 7a 65 5d 3b 0a | 0a 62 61 72 20 3d 20 66 |ysize];.|.bar = f|
|000003b0| 6f 6f 28 29 3b 0a 0a 66 | 6f 6f 28 29 20 7b 0a 20 |oo();..f|oo() {. |
|000003c0| 20 66 6f 6f 32 5b 61 72 | 72 61 79 73 69 7a 65 5d | foo2[ar|raysize]|
|000003d0| 3b 0a 20 20 72 65 74 75 | 72 6e 20 26 28 66 6f 6f |;. retu|rn &(foo|
|000003e0| 32 5b 30 5d 29 3b 0a 7d | 0a 0a 0a 54 68 6f 73 65 |2[0]);.}|...Those|
|000003f0| 20 74 77 6f 20 61 70 70 | 72 6f 61 63 68 65 73 20 | two app|roaches |
|00000400| 73 68 6f 75 6c 64 20 77 | 6f 72 6b 2e 20 52 65 6d |should w|ork. Rem|
|00000410| 65 6d 62 65 72 2c 20 74 | 68 65 20 6e 61 6d 65 20 |ember, t|he name |
|00000420| 6f 66 20 61 6e 20 61 72 | 72 61 79 20 77 69 74 68 |of an ar|ray with|
|00000430| 6f 75 74 20 0a 74 68 65 | 20 5b 5d 20 69 73 20 73 |out .the| [] is s|
|00000440| 69 6d 70 6c 79 20 61 20 | 70 6f 69 6e 74 65 72 20 |imply a |pointer |
|00000450| 74 6f 20 74 68 65 20 61 | 72 72 61 79 2e 0a 0a 0a |to the a|rray....|
|00000460| 4e 65 78 78 0a 0a 45 61 | 63 68 20 64 61 79 20 6f |Nexx..Ea|ch day o|
|00000470| 66 20 61 20 70 65 72 73 | 6f 6e 27 73 20 6c 69 66 |f a pers|on's lif|
|00000480| 65 20 69 73 20 61 20 62 | 61 74 74 6c 65 3b 0a 54 |e is a b|attle;.T|
|00000490| 68 65 20 65 6e 74 69 72 | 65 20 6c 69 66 65 20 62 |he entir|e life b|
|000004a0| 65 69 6e 67 20 74 68 65 | 20 77 61 72 2e 0a 41 20 |eing the| war..A |
|000004b0| 77 61 72 2c 20 6e 6f 74 | 20 61 67 61 69 6e 73 74 |war, not| against|
|000004c0| 20 61 6e 79 62 6f 64 79 | 20 65 6c 73 65 3b 0a 42 | anybody| else;.B|
|000004d0| 75 74 20 6f 6e 65 20 66 | 6f 75 67 68 74 20 61 67 |ut one f|ought ag|
|000004e0| 61 69 6e 73 74 20 6f 6e | 65 73 65 6c 66 2e 0a 4f |ainst on|eself..O|
|000004f0| 6e 65 20 6e 65 65 64 20 | 6e 65 76 65 72 20 74 6f |ne need |never to|
|00000500| 20 66 69 67 68 74 20 61 | 6c 6f 6e 65 3b 0a 46 6f | fight a|lone;.Fo|
|00000510| 72 20 6f 6e 65 20 73 68 | 61 6c 74 20 61 6c 77 61 |r one sh|alt alwa|
|00000520| 79 73 20 68 61 76 65 20 | 63 6f 6d 70 61 6e 69 6f |ys have |companio|
|00000530| 6e 73 20 6f 66 20 74 68 | 65 20 68 65 61 72 74 2e |ns of th|e heart.|
|00000540| 0a 0a 0a 4f 6e 20 33 20 | 41 70 72 20 31 39 39 36 |...On 3 |Apr 1996|
|00000550| 2c 20 52 69 63 6b 20 48 | 75 65 62 6e 65 72 20 77 |, Rick H|uebner w|
|00000560| 72 6f 74 65 3a 0a 0a 3e | 20 49 20 68 61 76 65 20 |rote:..>| I have |
|00000570| 6c 6f 6f 6b 65 64 20 69 | 6e 20 73 65 76 65 72 61 |looked i|n severa|
|00000580| 6c 20 74 65 78 74 73 20 | 61 6e 64 20 6c 6f 6f 6b |l texts |and look|
|00000590| 65 64 20 74 68 72 6f 75 | 67 68 20 74 68 65 20 66 |ed throu|gh the f|
|000005a0| 61 71 20 66 6f 72 20 74 | 68 69 73 20 71 75 65 73 |aq for t|his ques|
|000005b0| 74 69 6f 6e 0a 3e 20 61 | 6e 64 20 63 61 6e 27 74 |tion.> a|nd can't|
|000005c0| 20 66 69 6e 64 20 61 20 | 72 65 66 65 72 65 6e 63 | find a |referenc|
|000005d0| 65 20 66 6f 72 20 6d 79 | 20 61 6e 73 77 65 72 2e |e for my| answer.|
|000005e0| 20 20 49 20 61 6d 20 74 | 72 79 69 6e 67 20 74 6f | I am t|rying to|
|000005f0| 20 72 65 74 75 72 6e 20 | 61 6e 20 61 72 72 61 79 | return |an array|
|00000600| 2c 20 6f 72 0a 3e 20 61 | 20 70 6f 69 6e 74 65 72 |, or.> a| pointer|
|00000610| 20 74 6f 20 74 68 65 20 | 61 72 72 61 79 2c 20 66 | to the |array, f|
|00000620| 72 6f 6d 20 61 20 66 75 | 6e 63 74 69 6f 6e 2e 20 |rom a fu|nction. |
|00000630| 20 49 20 68 61 76 65 20 | 73 65 65 6e 20 73 65 76 | I have |seen sev|
|00000640| 65 72 61 6c 20 65 78 61 | 6d 70 6c 65 73 20 6f 66 |eral exa|mples of|
|00000650| 0a 3e 20 72 65 74 75 72 | 6e 69 6e 67 20 61 20 70 |.> retur|ning a p|
|00000660| 6f 69 6e 74 65 72 2c 20 | 62 75 74 20 69 74 20 64 |ointer, |but it d|
|00000670| 6f 65 73 6e 27 74 20 73 | 65 65 6d 20 74 6f 20 77 |oesn't s|eem to w|
|00000680| 6f 72 6b 20 66 6f 72 20 | 6d 65 2e 20 20 4d 79 20 |ork for |me. My |
|00000690| 66 75 6e 63 74 69 6f 6e | 20 69 73 20 67 6f 69 6e |function| is goin|
|000006a0| 67 0a 3e 20 74 6f 20 72 | 65 74 75 72 6e 20 61 6e |g.> to r|eturn an|
|000006b0| 20 61 72 72 61 79 20 6f | 66 20 69 6e 74 65 67 65 | array o|f intege|
|000006c0| 72 73 20 77 68 65 72 65 | 20 31 2d 38 30 20 6f 66 |rs where| 1-80 of|
|000006d0| 20 74 68 65 6d 20 77 69 | 6c 6c 20 62 65 20 73 69 | them wi|ll be si|
|000006e0| 67 6e 69 66 69 63 61 6e | 74 2e 20 20 54 68 65 0a |gnifican|t. The.|
|000006f0| 3e 20 63 61 6c 6c 69 6e | 67 20 66 75 6e 63 74 69 |> callin|g functi|
|00000700| 6f 6e 20 77 69 6c 6c 20 | 6b 6e 6f 77 20 68 6f 77 |on will |know how|
|00000710| 20 6d 61 6e 79 20 69 6e | 74 65 67 65 72 73 20 61 | many in|tegers a|
|00000720| 72 65 20 65 78 70 65 63 | 74 65 64 20 61 6e 64 20 |re expec|ted and |
|00000730| 77 69 6c 6c 20 72 65 61 | 64 20 74 68 65 6d 0a 3e |will rea|d them.>|
|00000740| 20 6f 66 66 20 74 68 65 | 20 61 72 72 61 79 2e 2e | off the| array..|
|00000750| 2e 2e 49 66 20 49 20 63 | 61 6e 20 67 65 74 20 74 |..If I c|an get t|
|00000760| 68 65 20 70 6f 69 6e 74 | 65 72 20 62 61 63 6b 20 |he point|er back |
|00000770| 74 6f 20 74 68 65 20 61 | 72 72 61 79 2e 20 20 41 |to the a|rray. A|
|00000780| 20 66 72 69 65 6e 64 20 | 6f 66 20 6d 69 6e 65 0a | friend |of mine.|
|00000790| 3e 20 74 6f 6c 64 20 6d | 65 20 74 6f 20 6a 75 73 |> told m|e to jus|
|000007a0| 74 20 6d 61 6b 65 20 74 | 68 65 20 61 72 72 61 79 |t make t|he array|
|000007b0| 20 61 20 67 6c 6f 62 61 | 6c 2c 20 62 75 74 20 49 | a globa|l, but I|
|000007c0| 20 64 6f 6e 27 74 20 77 | 61 6e 74 20 74 6f 20 64 | don't w|ant to d|
|000007d0| 6f 20 74 68 61 74 20 69 | 66 20 49 20 63 61 6e 0a |o that i|f I can.|
|000007e0| 3e 20 68 65 6c 70 20 69 | 74 2e 20 20 49 20 77 6f |> help i|t. I wo|
|000007f0| 75 6c 64 20 65 76 65 6e | 20 72 65 73 6f 72 74 20 |uld even| resort |
|00000800| 74 6f 20 61 20 72 65 63 | 75 72 73 69 76 65 20 66 |to a rec|ursive f|
|00000810| 75 6e 63 74 69 6f 6e 20 | 74 68 61 74 20 77 69 6c |unction |that wil|
|00000820| 6c 20 70 61 73 73 20 74 | 68 65 0a 3e 20 69 6e 74 |l pass t|he.> int|
|00000830| 65 67 65 72 73 20 62 61 | 63 6b 20 6f 6e 65 20 61 |egers ba|ck one a|
|00000840| 74 20 61 20 74 69 6d 65 | 20 69 66 20 74 68 61 74 |t a time| if that|
|00000850| 20 69 73 20 70 6f 73 73 | 69 62 6c 65 2e 20 20 44 | is poss|ible. D|
|00000860| 6f 65 73 20 61 6e 79 6f | 6e 65 20 68 61 76 65 20 |oes anyo|ne have |
|00000870| 61 6e 79 0a 3e 20 73 75 | 67 67 65 73 74 69 6f 6e |any.> su|ggestion|
|00000880| 73 3f 20 20 49 20 61 6d | 20 6f 70 65 6e 20 74 6f |s? I am| open to|
|00000890| 20 61 6e 79 74 68 69 6e | 67 20 61 6e 64 20 77 69 | anythin|g and wi|
|000008a0| 6c 6c 20 67 6f 20 6c 6f | 6f 6b 69 6e 67 20 69 66 |ll go lo|oking if|
|000008b0| 20 79 6f 75 20 63 61 6e | 20 74 65 6c 6c 20 6d 65 | you can| tell me|
|000008c0| 0a 3e 20 77 68 65 72 65 | 28 68 6f 70 65 66 75 6c |.> where|(hopeful|
|000008d0| 6c 79 20 6f 6e 6c 69 6e | 65 20 73 6f 6d 65 77 68 |ly onlin|e somewh|
|000008e0| 65 72 65 29 2e 0a 3e 20 | 0a 3e 20 54 68 61 6e 6b |ere)..> |.> Thank|
|000008f0| 73 2e 2e 2e 0a 3e 20 0a | 3e 20 2d 2d 0a 3e 20 52 |s....> .|> --.> R|
|00000900| 69 63 6b 20 48 75 65 62 | 6e 65 72 20 45 4d 54 2d |ick Hueb|ner EMT-|
|00000910| 50 20 46 46 20 42 53 0a | 3e 20 54 65 61 6d 20 4f |P FF BS.|> Team O|
|00000920| 53 2f 32 09 62 6f 75 72 | 6e 65 40 49 6e 66 6f 41 |S/2.bour|ne@InfoA|
|00000930| 76 65 2e 6e 65 74 0a 3e | 20 57 61 72 70 69 6e 67 |ve.net.>| Warping|
|00000940| 20 61 6c 6f 6e 67 20 74 | 68 65 20 49 6e 74 65 72 | along t|he Inter|
|00000950| 6e 65 74 0a 3e 20 0a 3e | 20 0a 3e 20 0a |net.> .>| .> . |
+--------+-------------------------+-------------------------+--------+--------+